﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for EChiTietKhuyenMai
/// </summary>
public class EChiTietKhuyenMai
{
    private int maKM;
    private int maSP;
    private int giamGia;
    private string noiDungGiam;
    public EChiTietKhuyenMai()
    { }
    public EChiTietKhuyenMai(int maKM, int maSP, int giamGia, string noiDungGiam)
    {
        this.maKM = maKM;
        this.maSP = maSP;
        this.giamGia = giamGia;
        this.noiDungGiam = noiDungGiam;
    }
    public int MaKM
    {
        get { return this.maKM; }
        set
        {
            if (value == null)
                throw new Exception("maKM not allow nullvalue.");
            this.maKM = value;
        }
    }
    public int MaSP
    {
        get { return this.maSP; }
        set
        {
            if (value == null)
                throw new Exception("maSP not allow nullvalue.");
            this.maSP = value;
        }
    }
    public int GiamGia
    {
        get { return this.giamGia; }
        set { this.giamGia = value; }
    }
    public string NoiDungGiam
    {
        get { return this.noiDungGiam; }
        set { this.noiDungGiam = value; }
    }
    public override string ToString()
    {
        return this.maKM + "; " + this.maSP + "; " + this.giamGia + "; " + this.noiDungGiam + "; ";
    }
    public override bool Equals(Object obj)
    {
        EChiTietKhuyenMai me = (EChiTietKhuyenMai)obj;
        bool ret = this.MaKM.Equals(me.MaKM) && this.MaSP.Equals(me.MaSP);
        return ret;
    }
    public override int GetHashCode()
    {
        return this.MaKM.GetHashCode() + this.MaSP.GetHashCode();
    }


}